package com.estar.integaration;

import com.estar.integaration.Service.IMaterialService;
import com.estar.integaration.Util.DateUtil;
import com.estar.integaration.entity.Material;
import freemarker.template.SimpleDate;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;

@SpringBootTest
public class DBtest {

    Logger log = Logger.getLogger(DBtest.class.getName());
    @Autowired
    IMaterialService materialService;
    @Test
    public void test(){
//        System.out.println("test");
        List<Material> materialList = materialService.selectListByDateOneMonth();
        for(Material material:materialList){
            System.out.println(material);
        }
    }

    @Test
    public void testTime(){
        Date date = DateUtil.getOneMonthBeforeDate();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String format = simpleDateFormat.format(date);
        log.info(format);
//        log.info(date.toString());
    }
}
